{extend name="property/public/insidePageBase" /}
{block name="title"}待审核账单{/block}
{block name="css"}
{__block__}
<style>
    .layui-table-view .layui-table[lay-size=lg] .layui-table-cell {
        height: auto;
        line-height: 28px;
    }
</style>
{/block}
{block name="body"}
<div class="layuimini-container">
    <div class="layuimini-main">
        <form class="layui-form layui-form-pane" action="">
            <div class="layui-inline">
                <label class="layui-form-label">按月份筛选</label>
                <div class="layui-input-inline">
                    <div class="layui-input-inline" style="width: 98px;">
                        <input type="text" name="month_time" id="month-time" placeholder="账单生成月" class="layui-input">
                    </div>
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">关键词搜索</label>
                <div class="layui-input-inline">
                    <input type="text" name="keywords" autocomplete="off" class="layui-input" placeholder="请输入关键词搜索信息">
                </div>
            </div>
            <div class="layui-inline">
                <button type="submit" class="layui-btn layui-btn-primary"  lay-submit lay-filter="data-search-btn"><i class="layui-icon"></i> 搜 索</button>
            </div>
        </form>
        <table class="layui-hide" id="toAuditBill" lay-filter="toAuditBill"></table>
        <script type="text/html" id="tableBar">
            <div class="layui-btn-group">
               <a class="layui-btn layui-btn-sm" lay-event="details">详情</a>
            </div>
        </script>
        <script type="text/html" id="pay_type_tpl">
            {{# if(d.pay_type === 1) { }}<span class="layui-badge layui-bg-reg">线上</span>{{# } }}
            {{# if(d.pay_type === 2) { }}<span class="layui-badge layui-bg-blue">线下</span>{{# } }}


            {{# if(d.pay_method === 1) { }}<span class="layui-badge layui-bg-orange">微信</span>{{# } }}
            {{# if(d.pay_method === 2) { }}<span class="layui-badge layui-bg-blue">支付宝</span>{{# } }}
            {{# if(d.pay_method === 3) { }}<span class="layui-badge layui-bg-cyan">银联</span>{{# } }}
            {{# if(d.pay_method === 4) { }}<span class="layui-badge layui-bg-green">现金</span>{{# } }}
            {{# if(d.pay_method === 5) { }}<span class="layui-badge layui-bg-reg">企业微信</span>{{# } }}
        </script>
        <script type="text/html" id="check_method_tpl">
            {{# if(d.check_method === 1) { }}<span class="layui-badge layui-bg-reg">自动</span>{{# } }}
            {{# if(d.check_method === 2) { }}
                <span class="layui-badge layui-bg-blue">人工</span>
            {{d.check_username}}
            {{# } }}
        </script>
    </div>
</div>
{/block}
{block name="js"}
{__block__}
<script>
    layui.use(['form', 'table', 'laydate'], function () {
        var $ = layui.jquery, form = layui.form, table = layui.table,laydate = layui.laydate;
        var tableId = 'toAuditBill';
        laydate.render({
            elem: '#month-time',type: 'month'
        });
        table.render({
            elem: '#'+tableId,
            id:tableId,
            url: '{:url("propertyBillCourseStayAffirmList")}',
            toolbar: '#toolbar',
            cols: [[
                {title: '操作', width: 80, toolbar: '#tableBar', fixed:'left'},
                {field: 'number', width: 168, title: '账单编号', sort: true},
                {field: 'full_room_name', width: 198, title: '房间信息', sort: true},
                {field: 'pay_username', width: 108, title: '付款用户',sort: true},
                {field: 'pay_method', width: 138, title: '支付方式', templet:'#pay_type_tpl', sort: true},
                {field: 'pay_amount', width: 108, title: '支付金额', sort: true},
                {field: 'pay_remark', minWidth: 108, title: '备注说明', sort: true},
                {field: 'pay_time', width: 168, title: '支付时间', sort: true},
                {field: 'pay_method', width: 128, title: '审核方式', templet:'#check_method_tpl', sort: true},
                {field: 'check_amount', width: 108, title: '确认金额', sort: true},
                {field: 'check_time', width: 168, title: '确认时间', sort: true},
                {field: 'check_username', width: 168, title: '确认用户', sort: true},
                {field: 'check_remark', minWidth: 108, title: '审核备注', sort: true}
            ]],
            limits: [10, 15, 20, 25, 50, 100],
            limit: 15,
            page: true,
            height: 'full-80'
        });
        // 监听搜索操作
        form.on('submit(data-search-btn)', function (data) {table.reload(tableId, {page: { curr: 1  }, where: data.field}, 'data'); return false; });
        //监听行双击事件
        table.on('rowDouble('+tableId+')', function(obj){
            var data = obj.data;
            var url = '{:url("propertyBillCourseDetail")}?id=' + data.id;
            var index = parent.layer.open({title: data.number +'  支付记录详情', type: 2, shade: 0.2, maxmin:true, shadeClose:true, move:false,area: ['800px', '100%'],offset:  'rt', anim: 2, content: url , btn:false });
            return false;
        });
        table.on('tool('+tableId+')', function (obj) {
            var data = obj.data;
            if (obj.event === 'details') {
                var url = '{:url("propertyBillCourseDetail")}?id=' + data.id;
                var index = parent.layer.open({title: data.number +'  支付记录详情', type: 2, shade: 0.2, maxmin:true, shadeClose:true, move:false,area: ['800px', '100%'],offset:  'rt', anim: 2, content: url , btn:false });
                return false;
            }
        });
    });
</script>
{/block}